#include<string>
#include<iostream>
#include<vector>
using namespace std;

struct TreeNode {
    int val;
    TreeNode* left;
    TreeNode* right;
    TreeNode() : val(0), left(nullptr), right(nullptr) {}
    TreeNode(int x) : val(x), left(nullptr), right(nullptr) {}
    TreeNode(int x, TreeNode* left, TreeNode* right) : val(x), left(left), right(right) {}
};

int count1 = 0;
int ret = 0;
int kthSmallest(TreeNode* root, int k) {
    if (root == nullptr)
        return 0;

    int left = kthSmallest(root->left, k);
    if (++count1 == k)
    {
        ret = root->val;
        return root->val;
    }

    int right = kthSmallest(root->right, k);
    return ret;
}


vector<string> ret1;

void dfs(TreeNode* root, string path)
{
    if (root == nullptr) return;
    if (root->left == nullptr && root->right == nullptr)
    {
        path += to_string(root->val);
        ret1.push_back(path);
        return;
    }
    path += to_string(root->val);
    path += "->";
    dfs(root->left, path);

    dfs(root->right, path);
}

vector<string> binaryTreePaths(TreeNode* root) {
    string path;
    dfs(root, path);
    return ret1;
}



int main()
{
    TreeNode* root = new TreeNode();
    kthSmallest(root, 1);
    int a = 1;
    string s;
    s += to_string(a);
    cout << s;

	return 0;
}